<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <title>个人资料</title>
    <script src="javascript/jquery.min.js"></script>
    <script src="javascript/function.js"></script>
    <link rel="stylesheet" href="stylesheet/style_v1.1.css">
</head>
<body>
<div class="header-title">
    <a href="javascript:void(0);" class="fanhui">
        <img src="image/tick.png" alt="">
    </a>
    <p>个人资料</p>
</div>
<div class="con padding-top60 padding-bottom50 padding-lr5">
    <div class="adds-from">
        <input type="text" placeholder="姓名" id="desusername">
        <input type="text" placeholder="电话" id="desusermobile">
        <input type="text" placeholder="详细地址" id="desuseraddress">
    </div>
    <a href="javascript:void(0);" class="btn" onclick="updateUserInfo();">确认</a>
</div>
     <%@ include file="footer.jsp"%>
<script>
$(function () {
	 queryUserDetail();
});
function queryUserDetail() {
//	var params = "parms.goodsId=" + goodsId;
$.ajax({
			type : 'post',
			url : 'cliffordAction!queryUserInfo.action',
			async : false,
//				data : params, // 传给action的参数
			success : function(data) {
				if (data.result == 1) {
						if (data.resultData.size == '0') {
							alert("未获取到用户信息");
						}else if (data.resultData.size == '1') {
							var list = data.resultData.datalist;
							$("#desusername").val(list[0].userName);
							$("#desusermobile").val(list[0].userMobile);
							$("#desuseraddress").val(list[0].userAddress);
						} else {
							alert("用户信息不正确，请联系客服人员");
						}
				} else {
					alert(data.msg);
				}
			}
		});
}
function updateUserInfo() {
	var params = "parms.userName=" + $("#desusername").val();
	params +="&parms.userMobile=" +$("#desusermobile").val();
	params +="&parms.userAddress=" + $("#desuseraddress").val();
$.ajax({
			type : 'post',
			url : 'cliffordAction!updateUserInfo.action',
			async : false,
				data : params, // 传给action的参数
			success : function(data) {
				if (data.result == 1) {
					alert("保存成功");
					 location.href=document.referrer;
				} else {
					alert(data.msg);
				}
			}
		});
}
</script>
</body>
</html>